package com.wash.shoes.oss;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
@Data
public class ConstantProperties implements InitializingBean {

    @Value("${oss.endpoint}")
    private String endpoint;

    @Value("${oss.keyid}")
    private String keyid;

    @Value("${oss.keySecret}")
    private String keysecret;

    @Value("${oss.bucketname}")
    private String bucketName;

    @Value("${oss.filehost}")
    private String fileHost;

    @Value("${oss.baseUrl}")
    private String baseUrl;

    public static String ENDPOINT;
    public static String KEYID;
    public static String KEYSECRET;
    public static String BUCKETNAME;
    public static String FILEHOST;
    public static String BASEURL;

    @Override
    public void afterPropertiesSet() throws Exception {
        ENDPOINT = endpoint;
        KEYID = keyid;
        KEYSECRET = keysecret;
        BUCKETNAME = bucketName;
        FILEHOST = fileHost;
        BASEURL = baseUrl;
    }
}

